import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:lyf_shop/router/route_conifg.dart';
import 'package:lyf_shop/views/login/widget/login_button.dart';
import 'package:lyf_shop/views/login/widget/login_effect.dart';
import 'package:lyf_shop/views/login/widget/login_input.dart';
import 'package:lyf_shop/widget/appbar.dart';

class LYFLoginPage extends StatefulWidget {
  const LYFLoginPage({super.key});

  @override
  State<LYFLoginPage> createState() => _LYFLoginPageState();
}

class _LYFLoginPageState extends State<LYFLoginPage> {
  bool loginEnable = false;
  bool protect = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar:
          appBar("来伊份", "注册", bgColor:Theme.of(context).colorScheme.inversePrimary, () {
            Get.toNamed(LYFRouteConfig.register);
      }),
      body: Container(
        child: ListView(
          children: [
            LoginEffect(protect: protect),
            LoginInput(
              "用户名",
              "请输入用户名",
              onChanged: (text) {},
            ),
            LoginInput(
              "密码",
              "请输入密码",
              lineStretch: false,
              onChanged: (text) {},
              foucsChanged: (focus) {
                this.setState(() {
                  protect = focus;
                });
              },
            ),
            Padding(
              padding: const EdgeInsets.only(left: 24, right: 24, top: 60),
              child: LoginButton(
                "登录",
                enable: loginEnable,
                onPressed: () {

                },
              ),
            )
          ],
        ),
      ),
    );
  }
}
